<template>
  <div>
    <el-tabs v-model="activeName">
      <el-tab-pane name="tab1" v-if="areaId == 1" label="省公司汇总" />
      <el-tab-pane name="tab2" label="分公司认领" />
    </el-tabs>

    <keep-alive>
      <components :is="activeName"></components>
    </keep-alive>

  </div>
</template>
<script>
import { getSessionStorage } from "@/common/js/storage";
export default {
  components: {
    tab1: () => import("./superior/index.vue"),
    tab2: () => import("./subordinate/index.vue"),
  },
  data(){
    return {
      activeName: "tab2",
      areaId: "",
    }
  },
  created(){
    let accountInfo = getSessionStorage("accountInfo");
    this.areaId = accountInfo && JSON.parse(accountInfo).areaId;
    if(this.areaId == 1) { this.activeName = "tab1" }
    else { this.activeName = "tab2" }
  },
}
</script>
<style lang="scss" scoped>
/deep/ .el-tabs {
  padding: 0 6px !important;
}
</style>